function generate_pow(x,y) {
    return function () {
        return Math.pow(x,y)
    }
}
let x=2

let pow2=generate_pow(x,2)
let pow3=generate_pow(x,3)

console.log(pow2(2));
console.log(pow3(2));

function add(x,y,...rest) {
    console.log(x);
    console.log(y);
    console.log(rest);
}

add()
add(1)
add(1,2)
add(1,2,3)
add(1,2,3,4,5,6)